import React, {Component} from 'react'
import {View, Text, StyleSheet} from 'react-native'

//显示一行内容
class ContentLine extends Component {
    static defaultProps = {
        name: '',
        content: '',
        bold: false
    }

    render () {
        const props = this.props
        return (
            <View style={{flexDirection: 'row', margin: 5}}>
                <View style={[styles.homework_column]}>
                    <Text style={{fontWeight: props.bold ? 'bold' : 'normal', fontSize: 16}}>
                        {props.name}
                    </Text>
                </View>
                <View style={styles.homework_content}>
                    <Text style={{fontWeight: props.bold ? 'bold' : 'normal', fontSize: 16}}>
                        {props.content}
                    </Text>
                </View>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    homework_column: {
        alignItems: 'flex-end',
        paddingLeft: 15,
        justifyContent: 'center'
    },

    homework_content: {
        flex: 1,
        alignItems: 'flex-start',
        justifyContent: 'center',
        paddingLeft: 15
    }
  });

export default ContentLine